package com.feign;

import com.model.ProductYpRef;
import com.request.DeviceForm;
import com.request.PassengerFlowForm;
import com.request.ProductCorrectForm;
import com.request.ShopProductVersionForm;
import com.request.upload.RecResultRequest;
import com.response.ProductVO;
import com.response.Result;
import org.springframework.cloud.openfeign.FeignClient;
import org.springframework.http.MediaType;
import org.springframework.web.bind.annotation.*;

import javax.validation.constraints.NotNull;
import java.util.List;
import java.util.Optional;

import static org.springframework.http.MediaType.APPLICATION_JSON_VALUE;


@FeignClient(url = "https://binguoai.com", name = "localRecApiFeign")
//@FeignClient(url = "http://192.168.10.27", name = "localRecApiFeign")
public interface LocalRecApiFeign {


    @RequestMapping(value = "/api/local/getIpList", method = RequestMethod.POST, produces = MediaType.APPLICATION_JSON_VALUE)
    Result getIpList(@RequestBody DeviceForm deviceForm);


    @RequestMapping(value = "/api/product/version", method = RequestMethod.POST, produces = MediaType.APPLICATION_JSON_VALUE)
    Result getProductVersion(@RequestBody ShopProductVersionForm form);


    @RequestMapping(value = "/api/product/list", method = RequestMethod.GET, produces = MediaType.APPLICATION_JSON_VALUE)
    Result<List<ProductVO>> getProductList(@RequestParam("shopId") @NotNull Integer shopId,
                                           @RequestParam("majorCategoryId") Optional<Integer> majorCategoryId,
                                           @RequestParam("minorCategoryId") Optional<Integer> minorCategoryId,
                                           @RequestParam(name = "deviceId", required = false) String deviceId
    );


    @PostMapping(value = "/api/local/getYpProductList", produces = APPLICATION_JSON_VALUE)
    Result<List<ProductYpRef>> getYpProductList(@RequestParam("branchId") Integer branchId);


    @PostMapping(value = "/api/local/uploadRecResult", produces = APPLICATION_JSON_VALUE)
    Result uploadRecResult(@RequestBody RecResultRequest recResultRequest);


    @PostMapping(value = "/api/local/uploadCorrect", produces = APPLICATION_JSON_VALUE)
    Result uploadCorrect(@RequestBody ProductCorrectForm productCorrectForm);

    @PostMapping(value = "/api/wxapp/shopplace/add", produces = APPLICATION_JSON_VALUE)
    Result uploadPassenger(@RequestBody PassengerFlowForm passengerFlowForm);

    @PostMapping(value = "/api/local/getProductImgList", produces = APPLICATION_JSON_VALUE)
    Result getProductImgList(@RequestParam("branchId") Integer branchId);
}
